import request from '@/utils/request'
import { IDeparts } from '@/model/interface/departments'
const departmentUrl = '/company/department'

// 获取部门列表
export const getDepartmentAPI = () =>
  request({
    url: departmentUrl
  })

// 添加部门
export const addDepartmentAPI = (data: IDeparts) =>
  request({
    url: departmentUrl,
    method: 'post',
    data
  })

// 删除部门
export const delDepartmentAPI = (id: string) =>
  request({
    url: `${departmentUrl}/${id}`,
    method: 'DELETE'
  })

// 编辑部门
export const editDepartmentAPI = (id: string, data: IDeparts) =>
  request({
    url: `${departmentUrl}/${id}`,
    method: 'PUT',
    data
  })

// 获取详情
export const getDepartmentInfoAPI = (id: string) =>
  request({
    url: `${departmentUrl}/${id}`
  })
